//
//  ViewController.m
//  WebviewProgress
//
//  Created by 德益富 on 15/8/25.
//  Copyright (c) 2015年 Dyf. All rights reserved.
//

#import "ViewController.h"
#import "ZWWebViewBaseViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"进度条";
    self.view.backgroundColor=[UIColor lightGrayColor];
    [self.navigationController.navigationBar setBackgroundImage:[self imageWithColor:[UIColor whiteColor]]forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:[UIImage new]];
    
}


- (UIImage *)imageWithColor:(UIColor *)color
{
    CGFloat imageW = self.view.frame.size.width;
    CGFloat imageH = 1;
    // 1.开启基于位图的图形上下文
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(imageW, imageH), NO, 0.0);
    
    // 2.画一个color颜色的矩形框
    [color set];
    UIRectFill(CGRectMake(0, 0, imageW, imageH));
    
    // 3.拿到图片
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    
    // 4.关闭上下文
    UIGraphicsEndImageContext();
    
    return image;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    ZWWebViewBaseViewController *tempVC=[[ZWWebViewBaseViewController alloc] init];
    tempVC.m_url=@"http:www.baidu.com";
    tempVC.view.backgroundColor=[UIColor whiteColor];
    [self.navigationController pushViewController:tempVC animated:YES];
}

@end
